package com.numberone.master.modules.profit.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.numberone.master.common.persistence.Page;
import com.numberone.master.common.service.CrudService;
import com.numberone.master.modules.profit.entity.Account;
import com.numberone.master.modules.sys.service.OfficeService;
import com.numberone.master.modules.profit.dao.AccountDao;

/**
 * 利润Service
 * @author chengkang
 * @version 2018-02-12
 */
@Service
@Transactional(readOnly = true)
public class AccountService extends CrudService<AccountDao, Account> {
	
	@Autowired
	private AccountDao accountDao;
	
	@Transactional(readOnly = true)
	public Account get(String id) {
		return super.get(id);
	}
	
	
	@Transactional(readOnly = true)
	public List<Account> findList(Account account) {
		return super.findList(account);
	}
	
	@Transactional(readOnly = true)
	public Page<Account> findPage(Page<Account> page, Account account) {
		return super.findPage(page, account);
	}
	
	@Transactional(readOnly = false)
	public void save(Account account) {
		super.save(account);
	}

	@Transactional(readOnly = false)
	public void update(Account account) {
		super.update(account);
	}
	
	@Transactional(readOnly = false)
	public void delete(Account account) {
		super.delete(account);
	}
	
	public Page<Account> withdrawaPage(Page<Account> page, Account account) {
		account.setPage(page);
		page.setList(accountDao.withdrawaPage(account));
		return page;
	}
	
	@Transactional(readOnly = false)
	public Double getTotalMoney(String accountNo){
		return accountDao.getTotalMoney(accountNo);
	}
	
	@Transactional(readOnly = false)
	public Double getProfitMoney(String accountNo){
		return accountDao.getProfitMoney(accountNo);
	}
	
}